package com.etop.learnapp.fragment;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;

import com.etop.learnapp.R;
import com.etop.learnapp.activity.ApplyActivity;
import com.etop.learnapp.personalClass.Basic_Info;


public class Basic_Info_Fragment extends Fragment {

    View view;
    Basic_Info basic_info;
    public Button btnNext1;
    private EditText etUnit, etSubject, etProvince, etLeader, etPhone, etRemarks;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        basic_info = ((ApplyActivity) this.getActivity()).basicInfos;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment

        view = inflater.inflate(R.layout.fragment_basic_info, container, false);
        init();
        return view;
    }

    public void init() {
        btnNext1 = (Button) view.findViewById(R.id.btn_Next1);
        btnNext1.setOnClickListener((ApplyActivity) getActivity());


        etUnit = (EditText) view.findViewById(R.id.etUnit);
        etSubject = (EditText) view.findViewById(R.id.etSubject);
        etProvince = (EditText) view.findViewById(R.id.etProvince);
        etLeader = (EditText) view.findViewById(R.id.etLeader);
        etPhone = (EditText) view.findViewById(R.id.etPhone);
        etRemarks = (EditText) view.findViewById(R.id.etRemarks);
    }

    @Override
    public void onResume() {
        super.onResume();
//        if(basic_info.getUnit() != null)etUnit.setText(basic_info.getUnit().toString());
//        if(basic_info.getSubject() != null)etSubject.setText(basic_info.getSubject().toString());
    }


    public void saveInfo() {
    //
//        if (etUnit.getText() != null) basic_info.setUnit(etUnit.getText().toString());
//        if (etSubject.getText() != null) basic_info.setSubject(etSubject.getText().toString());
//        if (etProvince.getText() != null) basic_info.setProvince(etProvince.getText().toString());
    }
}




